package edu.gatech.oad;

public class Item {

	protected String status;
	protected String category;
	protected String location;
	protected String itemDescription;
	protected String date;
	protected String user;
	
	/**
	 * 
	 * @param type - type of item (lost, found, donation)
	 * @param itemName - Name of Item 
	 * @param userLocation - location of user claiming item
	 * @param dateFound - date that user lost or found item
	 * @param itemDescription - Description of item
	 */
	
	public Item(String status, String category, String location,  String itemDescription, String date, String user){
		this.status = status;
		this.category = category;
		this.location = location;
		this.itemDescription = itemDescription;
		this.date = date;
		this.user = user;
	}
	
	public int compare(Item i){
		if (status.equalsIgnoreCase(i.getStatus()))return 0;
		if (getUser().equalsIgnoreCase(i.getUser()))return 0;
		int score = 0;
		if (category.equalsIgnoreCase(i.getCategory())){
			score ++;
		}
		if (itemDescription.equalsIgnoreCase(i.getItemDescription())){
			score += 4;
		}
		if (location.equalsIgnoreCase(i.getLocation())){
			score += 4;
		}
		return score;
	}
	
	public String getStatus() {
		if(status==null) status="";
		return status;
	}
	
	public String getCategory() {
		if(category==null) category="";
		return category;
	}
	
	public String getLocation() {
		if(location==null) location="";
		return location;
	}
	
	public String getItemDescription() {
		if(itemDescription==null) itemDescription="";
		return itemDescription;
	}
	
	public String getDate() {
		if(date==null) date="";
		return date;
	}
	
	public String getUser() {
		if(user==null) user="";
		return user;
	}
	
	public String toString() {
		return status.toLowerCase() + ";" + category.toLowerCase() + ";" + location.toLowerCase() + ";" + itemDescription.toLowerCase() + ";" + date;
	}
}
